import React from 'react';
import { Modal, notification } from 'antd';
import ajax from '../../utils/ajax';

//图片的查看详情组件

class MessageView extends React.Component {

  state = {
    message1: '',
    message2: '',
    message3: '',
    message4: '',
    messageViewVisible: false
  }

  messageView = () => {
    var _this = this;
    let dn = _this.props.dn;
    ajax.post({
          url: "/accountbill/getAccountMessage",
          params: {dn : dn},
          success: function (res) {
            let accountbill = res.data;
            let message1 = '收款方式:'+ accountbill.platform;
            let message2 = '收款账号:'+ accountbill.accountNum;
            let message3 = '收款人姓名:'+ accountbill.userName;
            let message4 = '联系方式:'+ accountbill.phoneNumber;
            let ph = accountbill.phoneNumber;
            if (ph == '' || ph == undefined || ph == null) {
              message4 = '联系方式: 无';
            }
             _this.setState({ message1 : message1, message2 : message2, message3 : message3, message4 : message4});
             _this.setState({ messageViewVisible: true });
             console.log("liyang");
          }
    })
    console.log(dn);
  }

  hideModal = () => {
    this.setState({ messageViewVisible: false });
  }

  handleModalOk = () => {
    this.setState({ messageViewVisible: false });
  }

  render() {
    return (
      <div>
        <a href="javascript:void(0)" onClick={this.messageView}>收款信息</a>
        <Modal title="收款信息" visible={this.state.messageViewVisible} onOk={this.handleModalOk}
          onCancel={this.hideModal}>
          {this.state.message1} <br/>
          {this.state.message2} <br/>
          {this.state.message3} <br/>
          {this.state.message4}
        </Modal>
      </div>
    );
  }
}

export default MessageView;
